# !/usr/bin/env python
# encoding: utf-8


"""
  @author: gaogao
  @file: qmlpolarchart.py
  @time: 2021/6/3 12:15
  @desc:
"""

import os
from pathlib import Path
import sys

from PySide6.QtQuick import QQuickView
from PySide6.QtCore import Qt, QUrl
from PySide6.QtWidgets import QApplication, QMainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)
    viewer = QQuickView()

    src_dir = Path(__file__).resolve().parent
    viewer.engine().addImportPath(os.fspath(src_dir))
    viewer.engine().quit.connect(viewer.close)

    viewer.setTitle = "QML Polar Chart"
    viewer.setSource(QUrl.fromLocalFile(os.fspath(src_dir / 'main.qml')))
    viewer.setResizeMode(QQuickView.SizeRootObjectToView)
    viewer.show()
    sys.exit(app.exec())
